ReportTemplateView = Ext.extend(Ext.Panel, {
	constructor : function(a) {
		Ext.applyIf(this, a);
		this.initUIComponents();
		ReportTemplateView.superclass.constructor.call(this, {
			id : "ReportTemplateView",
			title : "用户注册报表",
			iconCls : "menu-appuser",
			autoScroll : true
		});
	},
	initUIComponents : function() {
		this.initSearchPanel();
		this.initGridPanel();
		this.items = [ this.searchPanel, this.gridPanel ];
	},
	onSearch : function(c) {
		var a = Ext.getCmp("ReportSearchForm");
		var b = Ext.getCmp("ReportGrid");
		if (a.getForm().isValid()) {
			a.getForm().submit( {
				waitMsg : "正在提交查询",
				url : __ctxPath + "/system/listMember.do",
				success : function(e, f) {
					var d = Ext.util.JSON.decode(f.response.responseText);
					b.getStore().loadData(d);
				}
			});
		}
	}
});
ReportTemplateView.prototype.initSearchPanel = function() {
	this.searchPanel = new Ext.FormPanel( {
		height : 35,
		frame : false,
		border : false,
		id : "ReportSearchForm",
		layout : "hbox",
		layoutConfig : {
			padding : "5",
			align : "middle"
		},
		defaults : {
			xtype : "label",
			border : false,
			margins : {
				top : 0,
				right : 4,
				bottom : 4,
				left : 4
			}
		},
		items : [ {
			text : "开户状态"
		},{
			hiddenName : "Q_signState_S_EQ",
			xtype : "combo",
			mode : "local",
			editable : false,
			triggerAction : "all",
			store : [["", "所有"], [ "1", "已开户" ], [ "0", "未开户" ] ],
			value : ""
		}, {
			xtype : "button",
			text : "查询",
			iconCls : "search",
			scope : this,
			handler : this.onSearch.createCallback(this)
		} ]
	});
};
ReportTemplateView.prototype.initGridPanel = function() {
	this.toolbar = new Ext.Toolbar( {
		height : 30,
		items : []
	});
	var b = new Ext.data.Store( {
		proxy : new Ext.data.HttpProxy( {
			url : __ctxPath + "/system/listMember.do"
		}),
		reader : new Ext.data.JsonReader( {
			root : "result",
			totalProperty : "totalCounts",
			fields : [ {
				name : "id",
				type : "int"
			}, "state", "mobile", "tradeAccId", "signState",
			{
				name : "regDate"
			} ]
		}),
		remoteSort : true
	});
	b.setDefaultSort("id", "desc");
	b.load( {
		params : {
			start : 0,
			limit : 25
		}
	});
	var e = new Ext.grid.CheckboxSelectionModel();
	var a = new Ext.grid.ColumnModel(
			{
				columns : [
						new Ext.grid.RowNumberer(),
						{
							header : "id",
							dataIndex : "id",
							hidden : true
						},
						{
							header : "签约状态",
							dataIndex : "signState",
							hidden : true
						},
						{
							header : "状态",
							dataIndex : "state",
							width : 30,
							renderer : function(f, m, r) {
								var signstate = r.get("signState");//签约状态
								var g = "";
								if(signstate == "0"){
									if (f == "1") {
										g += "注册完成";
									} else if(f == "2") {
										g += "已阅读并同意入市风险告知";
									} else if(f == "3") {
										g += "详细信息填写完毕";
									} else if(f == "7") {
										g += "资料审核通过，银行未签约";
									}
								}else{
									g += "开户成功";
								}
								return g;
							}
						},
						{
							header : "手机号",
							dataIndex : "mobile",
							exprint : true
						},
						{
							header : "交易账号",
							dataIndex : "tradeAccId",
							width : 60
						},
						{
							header : "注册时间",
							dataIndex : "regDate",
							width : 100
						}],
				defaults : {
					sortable : true,
					menuDisabled : true,
					width : 100
				}
			});
	this.gridPanel = new Ext.grid.GridPanel( {
		id : "ReportGrid",
		tbar : this.toolbar,
		store : b,
		autoHeight : true,
		shim : true,
		trackMouseOver : true,
		disableSelection : false,
		loadMask : true,
		cm : a,
		sm : e,
		viewConfig : {
			forceFit : true,
			enableRowBody : false,
			showPreview : false
		},
		bbar : new Ext.PagingToolbar( {
			pageSize : 25,
			store : b,
			displayInfo : true,
			displayMsg : "当前显示从{0}至{1}， 共{2}条记录",
			emptyMsg : "当前没有记录"
		})
	});
	this.gridPanel.addListener("rowdblclick", d);
	var c = this.gridPanel;
	function d(g, f, h) {
		g.getSelectionModel().each(function(j) {
			var i = j.data.userId;
		});
	}
};
